<?php
/**
 * Created by PhpStorm.
 * User: zhanglei
 * Date: 2018/4/10
 * Time: 10:48
 */

namespace app\admin\validate;


use think\Validate;

class Admin extends Validate
{
    protected $rule = [
        'user_name'=> 'require|unique:admin',
        'email'=> 'require|unique:admin|email',
        'password'=> 'require',
        'repassword' => 'confirm:password',
        'opassword' => 'require',
    ];

    protected $message = [
        'user_name.require'=> '管理员用户名不能为空',
        'user_name.unique'=> '管理员用户名不能重复',
        'email.require'=> '管理员邮箱不能为空',
        'email.email'=> '请输入正确的邮箱',
        'email.unique'=> '管理员邮箱不能重复',
        'password.require'=> '管理员密码不能为空',
        'repassword.confirm' => '两次密码不一致',
        'opassword.require' => '原密码不能为空',
    ];

    protected $scene = [
        'edi'   =>  ['user_name','email'],
        'edi2'   =>  ['user_name','email','password','repassword'],
        'add'   =>  ['user_name','email','password','repassword'],
        'password_edi' => ['password','repassword','opassword'],
    ];
}